package com.h4313.ghome.ui.fragments;

import android.app.Activity;
import android.app.ListFragment;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

public class ModulesListFragment extends ListFragment {
	
	private OnModuleSelected mCallback;
		
	public interface OnModuleSelected{
		public void showModule(String module);
		
	}
	
	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);
		
		try{
			mCallback = (OnModuleSelected) activity;
		}catch (ClassCastException e){
			throw new ClassCastException(activity.toString() + 
					" must implement OnModuleSelected");
		}
	}
	
	@Override
	public void onListItemClick(ListView l, View v, int position, long id) {
		mCallback.showModule(((TextView)v).getText().toString());
		
		
	}

}
